package pres.liko.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;

/**
 * @ClassName: WebSecurityConfig
 * @Auther: liko
 * @Description:
 * @Date: 2022/10/31 18:55
 */
@EnableWebSecurity
@Slf4j
public class WebSecurityConfig {

    @Bean
    SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
        httpSecurity.csrf().disable();
        httpSecurity.authorizeRequests().antMatchers("/actuator/**").permitAll();
        httpSecurity.authorizeRequests().anyRequest().authenticated().and().httpBasic();
        return httpSecurity.build();
    }
}
